﻿using System;
using System.Data;
using System.Linq;
using ReflectionStudio.Core.Events;
namespace WPFExcelReport
{
    public partial class ITXEXRPT
    {
        public void JLTAB05BTP()
        {
            try
            {
                DataTable dtrSoruce = dsSource.Tables["ABPOS"];
                string BARCODE = "", SRC = "";
                int x = dtrSoruce.Rows.Count;
                int i = 0;
                int rows = 5;
                
                foreach (DataRow dw in dtrSoruce.Rows)
                {
                    SRC = dw["WBBTP"].ToString().Trim();
                    if (SRC == "") continue;
                    BARCODE = "*" + SRC + "*";
                    exAgent.SetCellValue(i * rows + 1, 1, BARCODE); 
                    
                    SRC = dw["ARTICLE"].ToString().Trim()+"/"+dw["WID"].ToString().Trim()+"/"+dw["TRA"].ToString().Trim()+"/"+dw["ART"].ToString().Trim();
                    exAgent.SetCellValue(i * rows + 3, 1, Helpers.Helper.Convert8859P1ToGB2312(SRC));
                    SRC = dw["FIN"].ToString().Trim() + "/" + dw["DES"].ToString().Trim();
                    exAgent.SetCellValue(i * rows + 4, 1, Helpers.Helper.Convert8859P1ToGB2312(SRC));
                    i = i + 1;
                    if (i < x)
                    {
                        exAgent.RangeCopy(1, rows, i * rows + 1, i * rows + rows);
                    }
                }
            }
            catch (Exception ex)
            {
                Tracer.Error(ex.StackTrace, ex);
            }
        } 
    }
}